import Taro , { Component } from '@tarojs/taro';
import { View, Text , WebView} from '@tarojs/components';

export default class WebViewContaziner extends Component {

   config = {
       navigationBarTitleText: ''
  }

  state={
    webUrl:'',
  }

  handleMessage(e){
    let data = e.detail 
    console.log("特定时机参数",data)
  }
  handleLoad(e){
    console.log("成功加载",e);
  }
  handleError(e){
    console.log("失败",e)
  }

  componentWillMount () {
    let url = encodeURI(this.$router.params.webUrl)
    this.setState({
      webUrl:url
    })
    console.log(this.$router.params.webUrl)
    console.log("加载了容器")
  }

  render() {
    return (
      <View>
        <WebView src={this.state.webUrl}
        onMessage={this.handleMessage.bind(this)}
        onLoad={this.handleLoad.bind(this)}
        onError={this.handleError.bind(this)}
        ></WebView>
      </View>
    );
  }
}